#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
using namespace std;

#include"RBTree.h"

void TestRBTree2()
{
	const int N = 100000;
	vector<int> v;
	v.reserve(N);
	srand(time(0));
	for (size_t i = 0; i < N; i++)
	{
		v.push_back(rand() + i);
	}

	size_t begin2 = clock();

	lh::RBTree<int, int> t;
	for (auto e : v)
	{
		t.Insert(make_pair(e, e));
	}
	size_t end2 = clock();

	cout << t.IsBalance() << endl;

	cout << "RBTree Insert:" << end2 - begin2 << endl;
	cout << "RBTree Height:" << t.Height() << endl;
	cout << "RBTree Size:" << t.Size() << endl;

	size_t begin1 = clock();
	for (size_t i = 0; i < N; i++)
	{
		t.Find((rand() + i));
	}

	size_t end1 = clock();
	cout << "RBTree Find:" << end1 - begin1 << endl << endl;
}

void TestRBTree3()
{
	lh::RBTree<int, int> rbtree1;

	int arr[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
	for (auto e : arr)
	{
		rbtree1.Insert({ e, e });
	}

	rbtree1.Inorder();

	lh::RBTree<int, int> rbtree2;

	rbtree2 = rbtree1;

	rbtree2.Inorder();

	cout << endl;



}

int main()
{
	//TestRBTree1();
	//TestRBTree2();
	TestRBTree3();

	return 0;
}
